package com.hfengxiang.example.canvasrotatedemo;

import android.os.Bundle;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import java.util.ArrayList;
import java.util.List;

public class FixHeaderListActivity extends AppCompatActivity {

    private RecyclerView mRvList;
    private List<Star> mList;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_fix_header_list);
        initData();
        initView();
    }

    private void initData() {
        mList = new ArrayList<>();
        for (int i = 0; i < 4; i++) {
            for (int j = 0; j < 20; j++) {
                String group = "快乐家族";
                String name = "何炅";
                if (i % 2 == 0) {
                    group = "天天兄弟";
                    name = "汪涵";
                }
                mList.add(new Star(name+j,group+i));
            }
        }
    }

    private void initView() {
        mRvList = (RecyclerView) findViewById(R.id.rv_list);
        mRvList.setLayoutManager(new LinearLayoutManager(this));
        mRvList.addItemDecoration(new StarDecoration());
        StarAdapter adapter = new StarAdapter(mList);
        mRvList.setAdapter(adapter);
    }
}